// Problem: 
// Contest: 
// URL: 
// Memory Limit: 
// Time Limit: 
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#include<bits/stdc++.h>
using namespace std;
#define int long long
inline int read(){
	int s=0,w=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
	while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
	return s*w;
}
vector<int> v(1001),tmp(1001),v0(1001);
void dfs(int p)
{
	if(p>0)dfs(p/2);
	if(p%2==0)
	{
		for(int i=1;i<=500;i+=1)
			for(int j=1;j<=500;j+=1)
				v[i+j-1]+=tmp[i]*tmp[j];
	}
	else
	{
		for(int i=1;i<=500;i+=1)
			for(int j=1;j<=500;j+=1)
				v[i+j-1]+=tmp[i]*tmp[j]*2;
	}
	for(int i=1;i<=500;i+=1)
	{
		v[i+1]+=v[i]/10;
		v[i]%=10;
	}
	tmp=v;
	v=v0;
}
signed main()
{
	int p;
	cin>>p;
	printf("%lld\n",(int)(log10(2)*p+1));
	tmp[1]=1;
	dfs(p);
	tmp[1]-=1;
	for(int i=500;i>=1;i-=1)//注意输出格式，50个换一行，第一个不用
		if(i!=500&&i%50==0)printf("\n%lld",tmp[i]);
	else printf("%lld",tmp[i]);
	return 0;
}
